/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "TINH_CAU_RS", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TinhCauRs.findAll", query = "SELECT t FROM TinhCauRs t"),
    @NamedQuery(name = "TinhCauRs.findByTime", query = "SELECT t FROM TinhCauRs t WHERE t.tinhCauRsPK.time = :time"),
    @NamedQuery(name = "TinhCauRs.findByResult", query = "SELECT t FROM TinhCauRs t WHERE t.tinhCauRsPK.result = :result"),
    @NamedQuery(name = "TinhCauRs.findByDescription", query = "SELECT t FROM TinhCauRs t WHERE t.description = :description")})
public class TinhCauRs implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TinhCauRsPK tinhCauRsPK;
    @Size(max = 200)
    @Column(name = "DESCRIPTION")
    private String description;

    public TinhCauRs() {
    }

    public TinhCauRs(TinhCauRsPK tinhCauRsPK) {
        this.tinhCauRsPK = tinhCauRsPK;
    }

    public TinhCauRs(Date time, short result) {
        this.tinhCauRsPK = new TinhCauRsPK(time, result);
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public TinhCauRsPK getTinhCauRsPK() {
        return tinhCauRsPK;
    }

    public void setTinhCauRsPK(TinhCauRsPK tinhCauRsPK) {
        this.tinhCauRsPK = tinhCauRsPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tinhCauRsPK != null ? tinhCauRsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TinhCauRs)) {
            return false;
        }
        TinhCauRs other = (TinhCauRs) object;
        if ((this.tinhCauRsPK == null && other.tinhCauRsPK != null) || (this.tinhCauRsPK != null && !this.tinhCauRsPK.equals(other.tinhCauRsPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.thienloc.omap.entity.TinhCauRs[ tinhCauRsPK=" + tinhCauRsPK + " ]";
    }
}
